/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main.ucm;

import main.model.*;
import main.view.*;
/**
 *
 * @author I'm kevin
 */
public class UserCardInput {

    private static UserCardInput uci;
    private String id;
    private PswTable pt;
    private MainTable mt;
//    private MsgSender sender;

    public UserCardInput() {
    }

    public UserCardInput(MainTable mt) {
        UserID_Model um = mt.getIDModel();
        id = um.getUserID();
    }

    public static UserCardInput getInstance(MainTable mt) {
        if (uci == null) {
            uci = new UserCardInput();
            uci.id = mt.getIDModel().getUserID();
        }
        return uci;
    }


    public int run() {
        if (id.length() != 10) {
            return -1;
        } else {
            pt = PswTable.getInstance(id);
//            PswTable_Model ptm = pt.getPswTable_Model();
//            JButton ok = ptm.getOk();
//            JButton cancel = ptm.getCancel();
//            ok.addActionListener(new java.awt.event.ActionListener() {
//                public void actionPerformed(java.awt.event.ActionEvent evt) {
//
//                    MsgSender.getInstance().toVerify();
//
////                    RegisterPanel rp = new RegisterPanel();
////                    rp.setVisible(true); mt.setVisible(false);
//                    //System.out.println(pt.getUserPsw_Model().getPsw().toString());
//                    //Check_UserType.getInstance(id, pt.getUserPsw_Model().getPsw().toString()).run();
//                }
//            });
//            cancel.addActionListener(new java.awt.event.ActionListener() {
//                public void actionPerformed(java.awt.event.ActionEvent evt) {
//                    //
//                }
//            });
        }
        return 0;
    }
}
